#pragma once

#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>

#define DEFAULT_CAPACITY 3
#define DEFAULT_CAPACITY_ADD 2
#define MAX_MEMBER 100
#define MAX_NAME 20
#define MAX_GENDER 7
#define MAX_TELE 12
#define MAX_ADDRESS 30

// Member infomation
typedef struct MemberInfo {
	char name[MAX_NAME];
	int age;
	char gender[MAX_GENDER];
	char tele[MAX_TELE];
	char addr[MAX_ADDRESS];
}MemberInfo;

// Contact list
typedef struct Contact {
	MemberInfo* data;
	// Current number of members
	int count;
	// Total capacity for member
	int capacity;
}Contact;

// Contact list initialization
int initContact(Contact* pc);

// Save contact list
void saveContact(const Contact* pc);

// Destroy contact list
void destroyContact(Contact* pc);

// Add a member
void addMember(Contact* pc);

// Display Contact list
void displayContact(Contact* pc);

// Delete a member
void deleteMember(Contact* pc);

// Search a member
void searchMember(Contact* pc);

// Modify a member
void modifyMember(Contact* pc);

// Sort Contact list
void sortContact(Contact* pc);